<?php

class ContactUsController extends BaseController {
	
	public function showContactUs(){
		$status = "";
		$headerMenu = "contactUs";
		
		$catList = Category::status(Options::STATUS_ACTIVE)->language()->orderBySequence("asc")->get(array(Options::DB_TABLE_CATEGORIES.'.id',Options::DB_TABLE_CATEGORIES.'.name'));
		$mostViewed = News::status(Options::STATUS_ACTIVE)->orderByMostViewed('desc')->language()->take(Options::PAGE_HOME_MOST_VIEWED_LIMIT)->get(array(Options::DB_TABLE_NEWS.'.id', Options::DB_TABLE_NEWS.'.title', Options::DB_TABLE_CATEGORIES.'.name'));
		$mostCommented = News::status(Options::STATUS_ACTIVE)->orderByMostCommented('desc')->language()->take(Options::PAGE_HOME_MOST_COMMENTED_LIMIT)->get(array(Options::DB_TABLE_NEWS.'.id', Options::DB_TABLE_NEWS.'.title', Options::DB_TABLE_CATEGORIES.'.name'));
		return View::make( 'contactUs', array( "status" => $status, "headerMenu" => $headerMenu, "catList" => $catList, "mostViewed" => $mostViewed, "mostCommented" => $mostCommented ));
	}
	
	public function postFeedback($lang) {
		require_once(app_path().'/lib/recaptchalib.php');
		$cond = false;
		
		$privatekey = Options::CAPTCHA_PRIVATE_KEY;
		$resp = recaptcha_check_answer ($privatekey,
				$_SERVER["REMOTE_ADDR"],
				$_POST["recaptcha_challenge_field"],
				$_POST["recaptcha_response_field"]);
		
		
		if (!$resp->is_valid) {
			$status = Options::PAGE_NEWS_DETAILS_COMMENT_CAPTCHA_ERROR;
		} else {
			$status = Options::PAGE_NEWS_DETAILS_COMMENT_CAPTCHA_OK;
			$cond = true;
		}
		
		
		
		
		
		
	}
}